public class LogicTest{
	public static void main(String[] args) {
		// 1.定义两个boolean类型的变量并初始化
		boolean b1 = true;
		boolean b2 = false;
		//2.打印数值
		System.out.println("b1 = " + b1);
		System.out.println("b2 = " + b2);

		System.out.println("-----------------------------------------");
		// System.out.println("b1 && b2 = " + b1 && b2);//错误: 二元运算符 '&&' 的操作数类型错误
		System.out.println("b1 && b2 = " + (b1 && b2));
		System.out.println("b1 || b2 = " + (b1 || b2));
		System.out.println("!b2 = " + !b2);
		//测试下短路特性
		int i1 = 3;
		int i2 = 4;
		
		boolean i3 = (++i1 == 3) && (++i2 == 4);
		System.out.println("i1 = " + i1);//4
		System.out.println("i2 = " + i2);//4
		System.out.println("i3 = " + i3);//false
	}
}
